import axios from "~/axios";
import { queryParams } from "~/composables/util";
export function getProduct(page, query = {}) {
  let r = queryParams(query);
  return axios.get(`/product?page=${page}${r}`);
}

export function createProduct(data) {
  return axios.post("/product", data);
}

export function updateProduct(id, data) {
  return axios.put(`/product/${id}`, data);
}

export function deleteProduct(id) {
  return axios.delete("/product/" + id);
}

export function getOneProduct(id) {
  return axios.get("/product/" + id);
}

//数据分析
export function getAnalyse(page, query = {}) {
  let r = queryParams(query);
  return axios.get(`/analyse?page=${page}${r}`);
}
//導出數據分析
export function getExProduct() {
  return axios.get("/exportproduct");
}
